import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * Created with IntelliJ IDEA.
 * User: Роман
 * Date: 17.02.13
 * Time: 17:20
 * To change this template use File | Settings | File Templates.
 */
public class PercolationTest {
    Percolation grid;

    @Before
    public void setUp() throws Exception {
        grid = new Percolation(3);
        grid.open(1, 1);
        grid.open(2, 1);
        grid.open(3, 1);
    }

    @Test
    public void testIsOpen() throws Exception {
        Assert.assertEquals(true, grid.isOpen(1, 1));
        Assert.assertEquals(true, grid.isOpen(2, 1));
        Assert.assertEquals(true, grid.isOpen(3, 1));
        Assert.assertEquals(false, grid.isOpen(3, 3));
    }

    @Test
    public void testIsFull() throws Exception {
        Assert.assertEquals(true, grid.isFull(1, 1));
        Assert.assertEquals(true, grid.isFull(2, 1));
        Assert.assertEquals(false, grid.isFull(2, 2));
    }

    @Test
    public void testPercolates() throws Exception {
        Assert.assertEquals(true, grid.percolates());
    }
}
